package com.zed.games.answer.show;

import com.zed.api.games.answer.show.AlternativeAnswer;
import com.zed.api.games.answer.show.AnswerShowWorld;

import java.io.Serial;
import java.util.Objects;

/**
 * {@link String},基于文本的展示题目
 *
 * @author Zed
 */
public class TextAnswerShowWorld extends AnswerShowWorld {
    @Serial
    private static final long serialVersionUID = 6121382867552826390L;

    private String text;

    public TextAnswerShowWorld(Builder builder) {
        super(builder);
        this.text = Objects.requireNonNull(builder.text, "\"text\" cannot be null.");
    }

    @Override
    public String getTheme() {
        return this.text;
    }

    /**
     * 创建构建器
     *
     * @return {@link Builder}
     */
    public static Builder newBuilder() {
        return new Builder();
    }

    public static class Builder extends AnswerShowWorld.Builder {

        private String text;

        @Override
        public Builder id(String id) {
            super.id(id);
            return this;
        }

        /**
         * 设置文本题目
         *
         * @param text {@link String}
         * @return {@link Builder}
         */
        public Builder text(String text) {
            this.text = text;
            return this;
        }

        @Override
        public Builder addAlternativeAnswer(AlternativeAnswer alternativeAnswer) {
            super.addAlternativeAnswer(alternativeAnswer);
            return this;
        }

        @Override
        public Builder addTips(String tip) {
            super.addTips(tip);
            return this;
        }

        @Override
        public Builder removeTips(String tip) {
            super.removeTips(tip);
            return this;
        }

        @Override
        public AnswerShowWorld build() {
            return new TextAnswerShowWorld(this);
        }
    }
}
